<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	template="/WEB-INF/templates/template.xhtml">



	<ui:define name="content">

<script type="text/javascript">            
                function handleMessage(data) {
                    $('.display').html(data);
                }            
        </script>


		<h1 class="title ui-widget-header ui-corner-all">PrimePush -
			Counter</h1>
		<div class="entry">
			<p>Counter is an instant global click counter. When you click the
				button, updated count value is updated on all connected clients.</p>

			<h:form id="form">
				<h:outputText id="out" value="#{loginBean.count}"	styleClass="ui-widget display" />
				<br />
				<p:commandButton value="Click"	actionListener="#{loginBean.increment}" />
			</h:form>

			<p:socket onMessage="handleMessage" channel="/counter" />



		</div>
	</ui:define>
</ui:composition>
